package org.example.viteVantDemo.constants;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * @author tnar
 * @Description Constants 常量对象
 **/
public class CS {

    //登录图形验证码缓存时间，单位：s
    public static final int VERCODE_CACHE_TIME = 60;

    /**
     * 系统类型定义
     **/
    public interface SYS_TYPE {
        String MCH = "MCH";
        String MGR = "MGR";
        Map<String, String> SYS_TYPE_MAP = new HashMap<>();
    }

    static {
        SYS_TYPE.SYS_TYPE_MAP.put(SYS_TYPE.MCH, "商户系统");
        SYS_TYPE.SYS_TYPE_MAP.put(SYS_TYPE.MGR, "运营平台");
    }

    /**
     * yes or no
     **/
    public static final byte NO = 0;
    public static final byte YES = 1;

    /**
     * 通用 可用 / 禁用
     **/
    public static final int PUB_USABLE = 1;
    public static final int PUB_DISABLE = 0;

    public static final Map<Integer, String> PUB_USABLE_MAP = new HashMap<>();

    static {
        PUB_USABLE_MAP.put(PUB_USABLE, "正常");
        PUB_USABLE_MAP.put(PUB_DISABLE, "停用");
    }

    /**
     * 账号类型:1-服务商 2-商户 3-商户应用
     */
    public static final byte INFO_TYPE_ISV = 1;
    public static final byte INFO_TYPE_MCH = 2;
    public static final byte INFO_TYPE_MCH_APP = 3;


    /**
     * 商户类型:1-普通商户 2-特约商户
     */
    public static final byte MCH_TYPE_NORMAL = 1;
    public static final byte MCH_TYPE_ISVSUB = 2;

    /**
     * 性别 1- 男， 2-女
     */
    public static final byte SEX_UNKNOWN = 0;
    public static final byte SEX_MALE = 1;
    public static final byte SEX_FEMALE = 2;

    /**
     * 默认密码
     */
    public static final String DEFAULT_PWD = "tnarpay666";


    /**
     * 允许上传的的图片文件格式，需要与 WebSecurityConfig对应
     */
    public static final Set<String> ALLOW_UPLOAD_IMG_SUFFIX = new HashSet<>();

    static {
        ALLOW_UPLOAD_IMG_SUFFIX.add("jpg");
        ALLOW_UPLOAD_IMG_SUFFIX.add("png");
        ALLOW_UPLOAD_IMG_SUFFIX.add("jpeg");
        ALLOW_UPLOAD_IMG_SUFFIX.add("gif");
        ALLOW_UPLOAD_IMG_SUFFIX.add("mp4");
    }


    public static final long TOKEN_TIME = 60 * 60 * 2; //单位：s,  两小时


    //access_token 名称
    public static final String ACCESS_TOKEN_NAME = "token";

    /** ！！不同系统请放置不同的redis库 ！！ **/
    /**
     * 缓存key: 当前用户所有用户的token集合  example: TOKEN_1001_HcNheNDqHzhTIrT0lUXikm7xU5XY4Q
     */
    public static final String CACHE_KEY_TOKEN = "TOKEN_%s";

    public static String getCacheKeyToken( String uuid) {
        return String.format(CACHE_KEY_TOKEN, uuid);
    }

    /**
     * 图片验证码 缓存key
     **/
    public static final String CACHE_KEY_IMG_CODE = "img_code_%s";

    public static String getCacheKeyImgCode(String imgToken) {
        return String.format(CACHE_KEY_IMG_CODE, imgToken);
    }


    /**
     * 登录认证类型
     **/
    public interface AUTH_TYPE {

        byte LOGIN_USER_NAME = 1; //登录用户名
        byte TELPHONE = 2; //手机号
        byte EMAIL = 3; //邮箱

        byte WX_UNION_ID = 10; //微信unionId
        byte WX_MINI = 11; //微信小程序
        byte WX_MP = 12; //微信公众号

        byte QQ = 20; //QQ
    }


    //菜单类型
    public interface ENT_TYPE {

        String MENU_LEFT = "ML";  //左侧显示菜单
        String MENU_OTHER = "MO";  //其他菜单
        String PAGE_OR_BTN = "PB";  //页面 or 按钮

    }

    //接口类型
    public interface IF_CODE {
        String PARKWAYPAY = "parkwaypay";//农商泊汇智慧停车开放平台接口
        String CCBPAY = "ccbpay"; //建行支付
        String CCBUNCONSCIOUS = "ccbUnconscious"; //建行无感
        String ETCPAY = "etcpay"; //ETC支付
        String ALIPAY = "alipay";   // 支付宝官方支付
        String WXPAY = "wxpay";     // 微信官方支付
        String YSFPAY = "ysfpay";   // 云闪付开放平台
        String XXPAY = "xxpay";     // 小新支付
        String PPPAY = "pppay";     // Paypal 支付
        String UNIONPAY = "unionpay"; //银联支付
        String CEBPAY = "cebpay"; //光大支付
        String ICBCPAY = "icbcpay"; //工行支付
        String BOCPAY = "bocpay"; //中行支付
        String UNIONUNCONSCIOUS = "unionUnconscious"; //银联无感
        String YSFNATIVE = "ysfNative"; //云闪付主扫
        String ICBCAGG = "icbcAgg"; //工行聚合支付
        String HTCPAY = "htcpay"; //好停车无感
        String YJFPAY = "yjfpay"; //光大云缴费
        String CMBCPAY = "cmbcpay"; //民生银行聚合
        String CMBPAY = "cmbpay"; //招商银行聚合
        String CMBPARK = "cmbpark"; //招商银行停车平台
        String CMBUNCONSCIOUS = "cmbUnconscious"; //招商无感
        String CIBPAY = "cibpay"; //兴业银行聚合
        String CGBPAY = "cgbpay"; //广发银行聚合
        String ABCPAY = "abcpay"; //农行聚合
        String CMPAY = "cmpay"; //招商cmpay聚合支付
        String XFTPAY = "xftpay"; //湖南星富通支付
        String WFTPAY = "wftpay"; //深圳威富通支付
        String LKLPAY = "lklpay"; //拉卡拉支付
        String BCMPAY = "bcmpay"; //交通银行支付
        String XDPAY = "xdpay"; // 信电支付
        String ICBCJFTPAY = "icbcjftpay"; //工行聚富通支付
        String CSPAY = "cspay"; //上海创识
        String NABCPAY = "nabcpay"; //新农行支付
    }


    //支付方式代码
    public interface PAY_WAY_CODE {

        // 特殊支付方式
        String QR_CASHIER = "QR_CASHIER"; //  ( 通过二维码跳转到收银台完成支付， 已集成获取用户ID的实现。  )
        String AUTO_BAR = "AUTO_BAR"; // 条码聚合支付（自动分类条码类型）

        String ALI_BAR = "ALI_BAR";  //支付宝条码支付
        String ALI_JSAPI = "ALI_JSAPI";  //支付宝服务窗支付
        String ALI_APP = "ALI_APP";  //支付宝 app支付
        String ALI_PC = "ALI_PC";  //支付宝 电脑网站支付
        String ALI_WAP = "ALI_WAP";  //支付宝 wap支付
        String ALI_QR = "ALI_QR";  //支付宝 二维码付款

        String YSF_BAR = "YSF_BAR";  //云闪付条码支付
        String YSF_JSAPI = "YSF_JSAPI";  //云闪付服务窗支付
        String YSF_APP = "YSF_APP";  //云闪付APP 支付
        String YSF_NATIVE = "YSF_NATIVE";  //云闪付服务窗支付

        String WX_JSAPI = "WX_JSAPI";  //微信jsapi支付
        String WX_LITE = "WX_LITE";  //微信小程序支付
        String WX_BAR = "WX_BAR";  //微信条码支付
        String WX_H5 = "WX_H5";  //微信H5支付

        String PARKWAY_H5 = "PARKWAY_H5";//农商泊汇智慧停车开放平台接口H5支付

        String WX_NATIVE = "WX_NATIVE";  //微信扫码支付

        String PP_PC = "PP_PC"; // Paypal 支付
        String CEB_H5 = "CEB_H5";  //光大H5支付

        // 银联聚合支付
        String UNION_ALI_APP = "UNION_ALI_APP";  // 银联-支付宝APP
        String UNION_WX_APP = "UNION_WX_APP";    // 银联-微信APP
        String UNION_YSF_APP = "UNION_YSF_APP";  // 银联-云闪付APP
        String UNION_WX_LITE= "UNION_WX_LITE";   // 银联-微信小程序

        String CCB_AGG = "CCB_AGG";  //建行聚合
        String CCB_BAR = "CCB_BAR";  //建行聚合被扫
        String CCB_QR = "CCB_QR";  //建行聚合主扫
        String PANDA_AGG = "PANDA_AGG";//建行熊猫H5支付

        String UNION_UNCONSCIOUS = "UNION_UNCONSCIOUS"; // 银联无感
        String CCB_UNCONSCIOUS = "CCB_UNCONSCIOUS"; // 建行无感
        String CMB_MPARK_UNCONSCIOUS = "CMB_MPARK_UNCONSCIOUS"; // 招行无感（停车平台）
        String CMB_OPEN_UNCONSCIOUS = "CMB_OPEN_UNCONSCIOUS"; // 招行无感（一网通）
        String NIP = "NIP"; // 工行无感
        String FLYOS_ETC = "FLYOS_ETC";//车道ETC支付
        // 光大云缴费扫码
        String YJF_NATIVE = "YJF_NATIVE";

        String BCM_H5 = "BCM_H5";  //bcm h5
        String BCM_BAR = "BCM_BAR";  //bcm BAR

        String XD_APP = "XD_APP"; // 信电APP
        String XD_UNCONSCIOUS = "XD_UNCONSCIOUS"; // 信电无感
    }

    public static String DIRECT_PAY_CODE[]={"QR_CASHIER","2000","unionUnconscious"};

    //支付数据包 类型
    public interface PAY_DATA_TYPE {
        String PAY_URL = "payurl";  //跳转链接的方式  redirectUrl
        String FORM = "form";  //表单提交
        String WX_APP = "wxapp";  //微信app参数
        String WX_LITE = "wxlite";  //微信app参数
        String ALI_APP = "aliapp";  //支付宝app参数
        String YSF_APP = "ysfapp";  //云闪付app参数
        String CODE_URL = "codeUrl";  //二维码URL
        String CODE_IMG_URL = "codeImgUrl";  //二维码图片显示URL
        String NONE = "none";  //无参数
        String QR_CONTENT = "qrContent";  //二维码实际内容
        String UNION_APP = "unionapp";  //银联unionapp参数
        String CEB_APP = "cebapp";  //光大cebapp参数

        String UNION_UNCONSCIOUS = "unionUnconscious"; //银联无感

        String HTC_NOSENSE = "htcNosense"; //好停车无感

        String BOC_NOSENSE = "bocNosense"; //中行无感
        String ICBC_NOSENSE = "icbcNosense"; //中行无感

        String XD_UNCONSCIOUS = "xdUnconscious"; //信电无感
    }


    //接口版本
    public interface PAY_IF_VERSION {
        String WX_V2 = "V2";  //微信接口版本V2
        String WX_V3 = "V3";  //微信接口版本V3
    }
}
